package LFhalf {
	import tea.lib.KeyboardInput;
	public class HardwareInput
	{
		private var storeList:Array;
		private var pastDirect:int;
		private var inputKey:Object;
		
		public function HardwareInput(_inputObj:Object):void {
			storeList = [];
			inputKey = _inputObj;
			for (var i:String in inputKey) {
				storeList[i] = 0;
			}
		}
		
		public function eachFrame():PlayerInput {
			//3?7?
			var _List:Array = [];
			for (var i:String in inputKey) {
				if (KeyboardInput.intance.down(i)) {
					if (storeList[i]==-1) {
						_List[i] = 5;
					}else if(storeList[i]<8){
						_List[i] = 6;
					}else {
						_List[i] = 4;
					}
					storeList[i] = -1;
				}else {
					if (storeList[i]<0) {
						_List[i] = 2;
					}else {
						_List[i] = 1;
					}
					storeList[i]++;
				}
			}
			
			if (KeyboardInput.intance.direct() != 5) {
				if (pastDirect == KeyboardInput.intance.direct()) {
					if (storeList[pastDirect] < 8) {
						_List['direct'] = 6;
					}else {
						_List['direct'] = 5;
					}
				}else {
					_List['direct'] = 4;
				}
				storeList[KeyboardInput.intance.direct()] = -1;
			}else {
				if (pastDirect != 5) {
					_List['direct'] = 2;
				}else {
					_List['direct'] = 1;
				}
			}
			pastDirect = KeyboardInput.intance.direct();
			return new PlayerInput(pastDirect,_List['direct'],_List['A'],_List['J'],_List['D'],_List['S'], 0);
		}
		/*
		1empty
		2release
		3store
		4press start
		5pressing
		6double click
		7store double click
		
		UP DOWN LEFT RIGHT
		*/
		//
	}
	
}